package com.demo.threaddemo;

class ThreadDemo implements Runnable {

	private String name;

	ThreadDemo(String name) {
		this.name = name;
	}

	@Override
	public void run() {
		for (int i = 0; i < 10; i++) {
			System.out.println(name + "运行,i=" + i);
		}
	}

}

public class ImplementsRunableDemo {

	public static void main(String[] args) {
		ThreadDemo td1 = new ThreadDemo("线程A");
		ThreadDemo td2 = new ThreadDemo("线程B");

		new Thread(td1).start();
		new Thread(td2).start();

	}
}
